import http from '../http'

function login(username: string, password: string, fakeuser: string) {
  // console.log(`${import.meta.env.VITE_APP_AXIOS_BASE_URL}/mes-api/common/user/login`);
  // return http.post(`http://erp.aag.com/mes-api/common/user/login`, {
  let url = '';
  //#ifdef H5
  url = `/mes-api/common/user/login`;
  //#endif
  //#ifdef APP-PLUS
  url = import.meta.env.VITE_APP_AXIOS_BASE_URL + `/mes-api/common/user/login`;
  //#endif

  return http.post(url, {
    username,
    password

  })
}

function getinfo() {
  let url = '';
  //#ifdef H5
  url = `/mes-api/common/user/info?t=`;
  //#endif
  //#ifdef APP-PLUS
  url = import.meta.env.VITE_APP_AXIOS_BASE_URL + `/mes-api/common/user/info?t=`;
  //#endif
  return http.get(url + (new Date()).getTime(), {
    params: { token: uni.getStorageSync('token') }

  })
}




function getconfig(system: string, type: string) {
  let url = '';
  //#ifdef H5
  url = `/mes-api/config/simpleconfig/getlist?system=${system}&type=${type}&description=&pagesign=true`;
  //#endif
  //#ifdef APP-PLUS
  url = import.meta.env.VITE_APP_AXIOS_BASE_URL + `/mes-api/config/simpleconfig/getlist?system=${system}&type=${type}&description=&pagesign=true`;
  //#endif
  return http.get(url,
  )
}




export default {
  getinfo,
  login,
  getconfig,
}
